package chap4.Task1;
public class Task8 {
    public static void main(String[] args) {
        int i,j=0,t;
        System.out.println("1-10000以内的所有质数:");
        for(i=2;i<=10000;i++){
            for(t=2;t*t<=i;t++){
                if(i%t==0){
                    break;
                }
            }
            if(t*t>i){
                System.out.print(i+" ");
                j++;
                if(j%20==0)
                System.out.println();
            }
        }

        System.out.println("\n\n1-10000内共有"+j+"个质数");
    }
}
